package com.token.utils;

import cn.dev33.satoken.secure.SaSecureUtil;

/**
 * 密码工具类
 *
 * @auther: henriy
 * @Date: 2023/10/25
 */
public class PasswordUtils {

    private static final String secretKey = "1qaz2wsx@#$^%&*";

    /**
     * 加密
     *
     * @param password 明文密码
     * @return
     */
    public static String encrypt(String password) {
        return SaSecureUtil.aesEncrypt(secretKey, password);
    }

    /**
     * 解密
     *
     * @param cipherText 加密后的密码
     * @return
     */
    public static String decrypt(String cipherText) {
        return SaSecureUtil.aesDecrypt(secretKey, cipherText);
    }

    public static void main(String[] args) {
        String encrypt = encrypt("123456");
        System.out.println("加密后的值：" + encrypt);

        String decrypt = decrypt(encrypt);
        System.out.println("解密后的值：" + decrypt);
    }


}
